<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<base href="<?= $this->config->config['base_url'] ?>" />
<style>
body { font-family: Helvetica; font-size: 8pt; margin:0px 20px 0px 20px; padding: 10px 0px 0px 10px; line-height:8pt;}
h1 { font-family: Helvetica;; font-size:20px; font-weight:bold; line-height:20px;}					
h2 { font-family: Helvetica; font-size: 10px; font-weight:bold; margin-top:15px; line-height:10px;}
h3 { font-family: Helvetica; font-weight:bold; margin:5px 5px 5px 0px;}

.borderDotted {border-bottom:1px dotted #000; height:10px; padding:2px;}

</style>	
<title>Previzualizare factura</title>
</head>		
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td width="100%" valign="top"><br />
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td bgcolor="#333333"><table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
              <td width="45%" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="0" colspan="2"><div align="left">
                      <h1>FACTURA</h1>
                    </div></td>
                  </tr>
                  <tr>
                    <td width="40%" height="0"><div align="left">
                      <h2> Seria:
                        <?=$bill['seria'] ?>
                      </h2>
                    </div></td>
                    <td width="60%" height="0"><div align="left">
                      <h2> NR:
                        <?=$bill['numar'] ?>
                      </h2>
                    </div></td>
                  </tr>

                </table>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="40%"><div align="left">Data:</div></td>
                      <td width="60%"><div align="left">
                        <?=DateConvertFromMySql($bill['data'],'d-m-Y') ?>
                      </div></td>
                    </tr>
                  </table>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="40%"><div align="left">Cota T.V.A.</div></td>
                      <td width="60%"><div align="left">
                        <?=$bill['tva'] ?>
                        %</div></td>
                    </tr>
                    <tr>
                      <td width="40%"><div align="left"><b>Data scadentei:</b></div></td>
                      <td width="60%"><div align="left">
                        <?=DateConvertFromMySql($bill['data_scadentei'],'d-m-Y') ?>
                      </div></td>
                    </tr>
                </table></td>
              <td width="55%" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="30%" valign="top"><div align="left">Furnizor:</div></td>
                    <td width="70%" valign="top"><div align="left">
                      <?=$bill['compania'][0]['nume'] ?>
                    </div></td>
                  </tr>
                  <tr>
                    <td width="30%" valign="top"><div align="left">C.I.F.:</div></td>
                    <td width="70%" valign="top"><div align="left">
                      <?= $bill['compania'][0]['cui'] ?>
                    </div></td>
                  </tr>
                  <tr>
                    <td width="30%" valign="top"><div align="left">Capital social:</div></td>
                    <td width="70%" valign="top"><div align="left">
                      <?=$bill['compania'][0]['capital'] ?>
                    </div></td>
                  </tr>
                  <tr>
                    <td width="30%" valign="top"><div align="left">Nr.R.C/Aut.:</div></td>
                    <td width="70%" valign="top"><div align="left">
                      <?=$bill['compania'][0]['nr_reg'] ?>
                    </div></td>
                  </tr>
                  <tr>
                    <td width="30%" valign="top"><div align="left">Domiciliul fiscal:</div></td>
                    <td width="70%" valign="top"><div align="left">
                      <?=$bill['compania'][0]['adresa'] ?>
                    </div></td>
                  </tr>
                  <tr>
                    <td width="30%" valign="top"><div align="left"><b>IBAN RON:</b></div></td>
                    <td width="70%" valign="top"><div align="left">
                      <?=$bill['compania'][0]['iban1'] ?>
                    </div></td>
                  </tr>
                  <tr>
                    <td width="30%" valign="top"><div align="left">Banca:</div></td>
                    <td width="70%" valign="top"><div align="left">
                      <?=$bill['compania'][0]['banca1'] ?>
                    </div></td>
                  </tr>
                <tr>
                    <td width="30%" valign="top"><div align="left"><b>IBAN EUR:</b></div></td>
                  <td width="70%" valign="top"><div align="left">
                    <?=$bill['compania'][0]['iban2'] ?>
                  </div></td>
                </tr>
                  <tr>
                    <td width="30%" valign="top"><div align="left">Banca:</div></td>
                    <td width="70%" valign="top"><div align="left">
                      <?=$bill['compania'][0]['banca2'] ?>
                    </div></td>
                  </tr>
              </table></td>
            </tr>
          </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="20%" valign="top" bgcolor="#FFFFFF"><div align="left">Cumparator:</div></td>
                    <td width="80%" valign="top" bgcolor="#FFFFFF"><div align="left">
                        <?= $bill['client'][0]['nume'] ?>
                    </div></td>
                  </tr>
                  <tr>
                    <td width="20%" valign="top" bgcolor="#FFFFFF"><div align="left">Nr.R.C/Aut.: </div></td>
                    <td width="80%" valign="top" bgcolor="#FFFFFF"><div align="left">
                        <?=$bill['client'][0]['nr_reg'] ?>
                    </div></td>
                  </tr>
                  <tr>
                    <td width="20%" valign="top" bgcolor="#FFFFFF"><div align="left">C.I.F: </div></td>
                    <td width="80%" valign="top" bgcolor="#FFFFFF"><div align="left">
                        <?=$bill['client'][0]['cui'] ?>
                    </div></td>
                  </tr>
                  <tr>
                    <td width="20%" valign="top" bgcolor="#FFFFFF"><div align="left">Adresa:</div></td>
                    <td width="80%" valign="top" bgcolor="#FFFFFF"><div align="left">
                        <?=$bill['client'][0]['adresa'] ?>
                    </div></td>
                  </tr>
                  <tr>
                    <td width="20%" valign="top" bgcolor="#FFFFFF"><div align="left">Contul: </div></td>
                    <td width="80%" valign="top" bgcolor="#FFFFFF"><div align="left">
                        <?=$bill['client'][0]['cont'] ?>
                    </div></td>
                  </tr>
                  <tr>
                    <td width="20%" valign="top" bgcolor="#FFFFFF"><div align="left">Banca: </div></td>
                    <td width="80%" valign="top" bgcolor="#FFFFFF"><div align="left">
                        <?=$bill['client'][0]['banca'] ?>
                    </div></td>
                  </tr>
                </table></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="1" cellpadding="2">
            <tr>
              <td width="3%" height="40" valign="middle" bgcolor="#FFFFFF"><div align="center">Nr. <br />
                Crt </div></td>
              <td width="42%"  height="40" valign="middle" bgcolor="#FFFFFF"><div align="center">Denumirea produselor sau a serviciilor </div></td>
              <td width="7%"  height="40" valign="middle" bgcolor="#FFFFFF"><div align="center">U.M.</div></td>
              <td width="12%"  height="40" valign="middle" bgcolor="#FFFFFF"><div align="center">Cantitatea</div></td>
              <td width="12%"  height="40" valign="middle" bgcolor="#FFFFFF"><div align="center">Pretul unitar<br />
                (fara TVA)<br />
                -
                <?=$bill['moneda'] ?>
                - </div></td>
              <td width="12%"  height="40" valign="middle" bgcolor="#FFFFFF"><div align="center">Valoarea<br />
                -
                <?=$bill['moneda'] ?>
                -</div></td>
              <td width="12%"  height="40" valign="middle" bgcolor="#FFFFFF"><div align="center">TVA<br />
                -
                <?=$bill['moneda'] ?>
                -</div></td>
            </tr>
            <tr>
              <td width="3%" valign="middle" bgcolor="#FFFFFF"><div align="center">0</div></td>
              <td width="42%" valign="middle" bgcolor="#FFFFFF"><div align="center">1</div></td>
              <td width="7%" valign="middle" bgcolor="#FFFFFF"><div align="center">2</div></td>
              <td width="12%" valign="middle" bgcolor="#FFFFFF"><div align="center">3</div></td>
              <td width="12%" valign="middle" bgcolor="#FFFFFF"><div align="center">4</div></td>
              <td width="12%" valign="middle" bgcolor="#FFFFFF"><div align="center">5 (3x4)</div></td>
              <td width="12%" valign="middle" bgcolor="#FFFFFF"><div align="center">6</div></td>
            </tr>
            <tr>
              <td height="10" colspan="7" valign="middle" bgcolor="#FFFFFF"></td>
            </tr>
            <?
	$i=1;			  
	foreach($bill['articole'] as $k=>&$v){	
?>
            <tr>
              <td width="3%" 		height="5" valign="middle" bgcolor="#FFFFFF"><div align="center">
                  <?=$i ?>
              </div></td>
              <td width="42%"  	height="5" valign="middle" bgcolor="#FFFFFF"><div align="left">
                  <?=$v['produs'][0]['nume'] ?>
              </div></td>
              <td width="7%"  	height="5" valign="middle" bgcolor="#FFFFFF"><div align="center">
                  <?=$v['produs'][0]['um'] ?>
              </div></td>
              <td width="12%"  	height="5" valign="middle" bgcolor="#FFFFFF"><div align="center">
                  <?=$v['cantitate'] ?>
              </div></td>
              <td width="12%"  	height="5" valign="middle" bgcolor="#FFFFFF"><div align="center" style="width:100%;">
                  <?=$v['pret_unitar'] ?>
              </div></td>
              <td width="12%"  	height="5" valign="middle" bgcolor="#FFFFFF"><div align="center">
                  <?=$v['valoare'] ?>
              </div></td>
              <td width="12%"  	height="5" valign="middle" bgcolor="#FFFFFF"><div align="center">
                  <?=$v['tva'] ?>
              </div></td>
            </tr>
            <? 	$i++; }?>
            <tr>
              <td height="200" colspan="7" valign="top" bgcolor="#FFFFFF"><div id="detalii">
                  <? if(isset($bill['detalii']) && !empty($bill['detalii'])){?>
						<div align="left"  style="margin-top:2px; width:100%">Detalii:<?=$bill['detalii'] ?></div>
                  <? }?>
                  <? if(isset($bill['nr_contract']) && !empty($bill['nr_contract'])){?>
						<div align="left" style="margin-top:2px; width:100%">Numar contract:<?=$bill['nr_contract'] ?></div>
                  <? }?>
  				  <div align="left" style="margin-top:2px; width:100%">Intocmit de <?=$bill['FK_UTILIZATORI']['utilizator_nume'] ?>, CNP: <?=$bill['FK_UTILIZATORI']['utilizator_cnp'] ?></div>
              </td>
            </tr>
          </table>
            <table width="100%" border="0" cellspacing="1" cellpadding="2">
            <tr>
              <td width="20%" rowspan="3" valign="top" bgcolor="#FFFFFF"><div align="left" style="margin-bottom:10px;">Semnatura si stampila furnizorului</div>
                <div style="width:100%; padding:5px;">
                  <?
	if(isset($bill['compania'][0]['stampila']) & !empty($bill['compania'][0]['stampila'])){
?>
                  <img src="<?=$bill['compania'][0]['stampila'] ?>" style="border:none;" />
                  <? 	}?>
                </div></td>
              <td width="44%" rowspan="3" valign="top" bgcolor="#FFFFFF">
                    <div align="left" class="borderDotted">
                        <h3>Date privind expeditia:</h3>
                      </div>
                    <div align="left" class="borderDotted">Numele delegatului:
                      <?=$bill['delegat'] ?>
                    </div>
                    <div align="left" class="borderDotted">BI/CI:
                      <?=$bill['delegat_ci'] ?>
                    </div>					
                    <div align="left" class="borderDotted">Mijlocul de transport
                      <?=$bill['mijloc_transport'] ?>
                      nr.
                      <?=$bill['nr_auto'] ?>
                    </div>
                    <div align="left" class="borderDotted">Expedierea s-a facut in prezenta noastra la data de:</div>
                    <div align="left" class="borderDotted">
                      <?=DateConvertFromMySql($bill['data_emiterii'],'d-m-Y') ?>
                    </div>
              </td>
              <td width="12%" height="0" valign="middle" bgcolor="#FFFFFF"><div align="left" style="padding-left:5px;">Total din care accize: </div></td>
              <td width="12%" height="0" valign="middle" bgcolor="#FFFFFF"><div align="center">
                  <h3>
                    <?=$bill['TOTAL_VAL'] ?>
                  </h3>
              </div></td>
              <td width="12%" height="0" valign="middle" bgcolor="#FFFFFF"><div align="center">
                  <h3>
                    <?=$bill['TOTAL_TVA'] ?>
                  </h3>
              </div></td>
            </tr>
            <tr>
              <td rowspan="2" valign="top" bgcolor="#FFFFFF"><div align="left" style="padding-left:5px;">Semnatura de primire</div></td>
              <td width="12%" height="0" valign="middle" bgcolor="#FFFFFF">&nbsp;</td>
              <td width="12%" height="0" valign="middle" bgcolor="#FFFFFF"><div align="center">X</div></td>
            </tr>
            <tr>
              <td colspan="2" valign="middle" bgcolor="#FFFFFF"><div align="left">Total de plata:<br />
                (col.5 + col.6)</div>
                  <div align="center">
                    <div align="right" style="padding-right:30pt">
                    	<h3><?=$bill['TOTAL'] ?></h3>
                    </div>
                    <div align="right">
                      <h3><?=$bill['moneda'] ?></h3>
                    </div>
                  </div></td>
            </tr>
          </table></td>
        </tr>
      </table></td>
    </tr>
  
</table></td>
</tr>
</table>
</body>
</html>